import React, { Component } from "react";
import PropTypes from "prop-types";
import { eventTrack, messages } from "share/common";
import "styles/home/home-helios-news.scss";
import SVGIcon from "components/SVGIcon";

class HeliosNews extends Component {
  constructor(props) {
    super(props);
    this.state = {};
    this.newsList = [
      { title: messages("basic-1.key236") /*为汇联易代言，获8000元优惠“壕礼”！*/, link: "https://t.1yb.co/aevX" },
      {
        title: messages("basic-1.key237") /*cdf会员购单件包邮包税，限时6折起！*/,
        link:
          "https://mp.weixin.qq.com/s?__biz=MzU3NDgyODI1Nw==&mid=2247488780&idx=1&sn=d1c9f2c9aeb80b1410396382da05313e&chksm=fd2d2e82ca5aa794f52502d5e0d9a8291e4364ad005757f38512560549177c64e1ced72cfea0&mpshare=1&scene=1&srcid=1125jdMZAMzL7bB7UhUPpKv4&sharer_sharetime=1606295824326&sharer_shareid=01e3fd6c43e6bd5509c3897a2b4422af&key=f904f3cc95323c059eef09e7ade6a6a9939c624492614d4fc20baabbc59715bfefb0c78d2cb87402c0b6ca627fa74f319b3345f8511c17d2550a61ff171b4beb019620fd854d3d2ed993b33f066264d57d1ec1ece903c3b90b1c101636887919b747cbd39a0129811fb9938f2248936e7d749ae6ba286f021d90b8df97fd43ed&ascene=1&uin=MTc5Njc2ODY2MA%3D%3D&devicetype=Windows+10+x64&version=6300002f&lang=zh_CN&exportkey=ARImEr9%2FviBiRAmWOHguFZk%3D&pass_ticket=kCOCZRBN1N%2FoBbspEpBUu%2FMjpNaCF4fcNkr%2FY31h1vsFbAjw6goPXDOkzynFK1i3&wx_header=0",
      },
      {
        title: messages("basic-1.key238") /*汇联易x高德打车，企业用车便捷与精细管理新方向*/,
        link:
          "https://mp.weixin.qq.com/s?__biz=MzU3NDgyODI1Nw==&mid=2247488486&idx=1&sn=2ca8394b5e02a9aaf13455c09345738e&chksm=fd2d2868ca5aa17ec25c6ad6c92e0871ab1d87627954913788292e78cd691c09d9469d63aa73&mpshare=1&scene=1&srcid=1125hpyH7k5lhV6U0dvbBISw&sharer_sharetime=1606295883349&sharer_shareid=01e3fd6c43e6bd5509c3897a2b4422af&key=7f1dc552a243d4dbfaa6f15e34c6438ead4a6f4bc3dce39e09322ed252f6ce8fcf9ecca53414aa5c89e59c7d578406be30b5707c2085983a5cc448c10a5f691acdb073c58abe95f1935cd0882f0c1e453752c84d51908abdbce4e0c9de7523e04cc7f8d4ebafa99e1fe8b9700c48a5ad6e6d02a5cf9731eedec4428d32c46622&ascene=1&uin=MTc5Njc2ODY2MA%3D%3D&devicetype=Windows+10+x64&version=6300002f&lang=zh_CN&exportkey=AVTCHg2uIzPMJ7muOGg85Ec%3D&pass_ticket=kCOCZRBN1N%2FoBbspEpBUu%2FMjpNaCF4fcNkr%2FY31h1vsFbAjw6goPXDOkzynFK1i3&wx_header=0",
      },
      {
        title: messages("basic-1.key239") /*对公业务板块2.0全新上线，企业全方位管理现金流的更优选择！*/,
        link:
          "https://mp.weixin.qq.com/s?__biz=MzU3NDgyODI1Nw==&mid=2247489274&idx=1&sn=e4c29d19b6732e1f839b0fd69bb651f6&chksm=fd2d2d74ca5aa46278918797026df695e03de591609e83794ce16bf09e19ce0222eb577f370a&mpshare=1&scene=1&srcid=1125G7FhtclTo1ZCbppmOz1o&sharer_sharetime=1606295691554&sharer_shareid=01e3fd6c43e6bd5509c3897a2b4422af&key=7f1dc552a243d4db52c73a988b3c9160cf0a0f9f53fcf4709d4c11556d69793589d65ea6a2f234889e7e7cf3dd11573be74651e1e67b788838670f057699b74f13712b0918f13c6f46bdf3ddce008f69a1a81363918717accb7beed13f1fd885e6bb7febb237b8ba8a4eee41977fd8a5c6712f3bf229eb5b583a09740fdad60a&ascene=1&uin=MTc5Njc2ODY2MA%3D%3D&devicetype=Windows+10+x64&version=6300002f&lang=zh_CN&exportkey=Aa4QUdtguI8LKjiZQLzgbuc%3D&pass_ticket=kCOCZRBN1N%2FoBbspEpBUu%2FMjpNaCF4fcNkr%2FY31h1vsFbAjw6goPXDOkzynFK1i3&wx_header=0",
      },
      {
        title: messages("basic-1.key240") /*C+轮品牌发布会 | 汇联易宣布融资3亿元*/,
        link:
          "https://mp.weixin.qq.com/s?__biz=MzU3NDgyODI1Nw==&mid=2247487364&idx=1&sn=01805c7cc8eed6238e662de9d6766975&chksm=fd2d340aca5abd1ce0b561d7530886dd44ab4d435747024c8de7a12e4e02313a98c3a9d162ed&mpshare=1&scene=1&srcid=1125vi4HsJMpBLQUQYva3Oaz&sharer_sharetime=1606296012091&sharer_shareid=01e3fd6c43e6bd5509c3897a2b4422af&key=f904f3cc95323c050c0155d2d2198aa5358ef8dac032d7583a8946e4493e6d77856477205dad87f87e38ac501f7c6d96962ea34773f319a9e2abcabb8bad07c70d80e7670f9f6bb0d46687d5dfcb4a0f741214e0445483b5acec02d730a2950fb79d68383126fc61a5e3454380e473899760f80f05446d18885a788ac1e0aa44&ascene=1&uin=MTc5Njc2ODY2MA%3D%3D&devicetype=Windows+10+x64&version=6300002f&lang=zh_CN&exportkey=AepNti5Yz%2FKeQGPXu4dwf%2FM%3D&pass_ticket=kCOCZRBN1N%2FoBbspEpBUu%2FMjpNaCF4fcNkr%2FY31h1vsFbAjw6goPXDOkzynFK1i3&wx_header=0",
      },
    ];
  }

  componentWillMount() {}

  componentDidMount() {}

  goToMore = ({ title, url = "https://www.huilianyi.com/blog" } = {}) => {
    window.open(url, "_blank");
    if (title) {
      eventTrack({
        category: "1218-新首页-埋点",
        action: `【最新活动/文章】，点击查看了[${title}]`,
        label: this.props.tenant.tenantName,
      });
    } else {
      eventTrack({
        category: "1218-新首页-埋点",
        action: "【最新活动/文章】，点击查看了更多",
        label: this.props.tenant.tenantName,
      });
    }
  };

  render() {
    return (
      <div id={"home-helios-news-guide-id"} className="home-helios-news one-third-content">
        <div className="head-wrapper">
          <div className="home-title">{messages("basic-1.key241") /*最新活动/文章*/}</div>
          <div
            className="href"
            onClick={() => {
              this.goToMore();
            }}
          >
            {messages("common.more") /*更多*/}
            <SVGIcon className={"more-btn"} type={"home-more"} />
          </div>
        </div>
        <div className="card-content-wrapper news-content">
          {this.newsList.map((item) => {
            return (
              <div
                className="single-news"
                onClick={() => {
                  this.goToMore(item);
                }}
              >
                · {item.title}
              </div>
            );
          })}
        </div>
      </div>
    );
  }
}

HeliosNews.propTypes = {};

export default HeliosNews;
